﻿using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace monitor_server_2_WPF
{
    public delegate void CloseSplashDelegate();

    class Startup : Application
    {
        [STAThread]
        static void Main()
        {

            //Splasher.Splash = new SplashWindow(d);
            //Splasher.ShowSplash();

            var app = new Startup();
            Dictionaries(app);

            app.Start();

        }

        public void Start ()
        {
            //StartupUri = new Uri ( "MainWindow.xaml", UriKind.Relative );
            //ShutdownMode = ShutdownMode.OnExplicitShutdown;
            //CloseSplashDelegate d = Splasher.CloseSplash;
            //Run(new SplashWindow());

            
            //Run(new MainWindow(d));
            Run(new MainWindow());
        }

        private static void Dictionaries(Application app)
        {
            var rd1 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/Selen.Wpf.Core;component/MetroWindowResources.xaml")
            };
            var rd2 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml")
            };
            var rd3 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.Tooltip.xaml")
            };
            var rd4 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml")
            };
            var rd5 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/Selen.Wpf.Core;component/Resources.xaml")
            };
            var rd6 = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/Selen.Wpf.SystemStyles;component/Styles.xaml")
            };

            app.Resources.MergedDictionaries.Add(rd1);
            app.Resources.MergedDictionaries.Add(rd2);
            app.Resources.MergedDictionaries.Add(rd3);
            app.Resources.MergedDictionaries.Add(rd4);
            app.Resources.MergedDictionaries.Add(rd5);
            app.Resources.MergedDictionaries.Add(rd6);
        }

    }
}
